#include <iostream>

#include <vector>

using std::cout;
using std::endl;


int main()
{
	{
		std::vector<int> v{ 1, 2, 3, 4 };
		v.insert(v.begin(), 2, 9);
		cout << "vector size: " << v.size() << ", \nvector: ";
		for (auto i = v.begin(); i < v.end(); ++i)
		{
			cout << *i << "  ";
		}
		cout << endl;
		cout << "vector size: " << v.size() << endl;
		cout << "vector capacity: " << v.capacity() << endl;

		v.reserve(20);

		cout << "vector size: " << v.size() << endl;
		cout << "vector capacity: " << v.capacity() << endl;

		v.shrink_to_fit();
		cout << "vector size: " << v.size() << endl;
		cout << "vector capacity: " << v.capacity() << endl;
	}
	cout << endl;

	{
		std::vector<bool> vb{true, false,true};
		vb.push_back(true);
		vb.push_back(false);

		for each (bool b in vb)
		{
			cout << b;
		}
		cout << endl;

		vb.flip();

		for each (bool b in vb)
		{
			cout << b;
		}
		cout << endl;


		vb.reserve(20);
		cout << "vector<bool> size: " << vb.size() << endl;
		cout << "vector<bool> capacity: " << vb.capacity() << endl;
		vb.shrink_to_fit();
		cout << "vector<bool> capacity: " << vb.capacity() << endl;
	}
	cout << endl;

	return 0;
}









